package UseString.demo02;

import java.util.Scanner;

public class TestLand {
    public static void main(String[] args) {
        // 可以登陆三次
        String rightName = "小平平";
        String rightPassword = "123456";
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名");
            String name = sc.next();
            System.out.println("请输入密码");
            String password = sc.next();
            if (rightName.equals(name) && rightPassword.equals(password)){
                System.out.println("登陆成功，小baby");
                break;
            }else {
                if (i==2){
                    System.out.println("密码错误，小baby去联系管理员");
                }else {
                    System.out.println("密码错误，小baby还有"+(2-i)+"次");
                }

            }
        }

    }
}
